﻿using Abp.Domain.Entities.Auditing;
using FwProject.Authorization.Users;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace FwProject.ShoppingMall.Com
{
    /// <summary>
    /// 订单明细表
    /// </summary>
    [Table("shop_order_details")]
    public class ShopOrderDetails: FullAuditedEntity<Guid>
    {
        /// <summary>
        /// 用户id
        /// </summary>
        public long UserId { get; set; }
        
        /// <summary>
        /// 订单号
        /// </summary>
        public string OrderNumber { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public Guid? OrderId { get; set; }

        [ForeignKey("OrderId")]
        public virtual ShopOrder ShopOrder { get; set; }

        /// <summary>
        /// 购买数量
        /// </summary>
        public int ProductCount { get; set; } = 0;

        /// <summary>
        /// 商品编号
        /// </summary>
        public Guid ShopproductId { get; set; }

        /// <summary>
        /// 商品类别
        /// </summary>
        public Guid ShopTypeid { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        public string ShopName { get; set; }


        /// <summary>
        /// 商品下单时图片
        /// </summary>
        public string ShopImagePic { get; set; }

        /// <summary>
        /// 付款时单价
        /// </summary>
        public decimal PayPrice { get; set; } = 0m;
        /// <summary>
        /// 商品原始单价
        /// </summary>
        public decimal MarketPrice { get; set; } = 0m;
        /// <summary>
        /// 付款时商品应付
        /// </summary>
        public decimal PayTotalPrice { get; set; } = 0m;

        /// <summary>
        /// 付款时商品应付
        /// </summary>
        public decimal PayAmountPrice { get; set; } = 0m;
        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal DiscountPrice { get; set; } = 0m;

        /// <summary>
        /// 规格Id
        /// </summary>
        public Guid ShopSkuId { get; set; }
        /// <summary>
        /// sku组合名称
        /// </summary>
        public string SkuName { get; set; }

        /// <summary>
        /// 发货时间
        /// </summary>
        public DateTime? DeliveryTime { get; set; }

        /// <summary>
        /// 订单发货状态
        /// </summary>
        public DeliveryStatus DeliveryStatus { get; set; } = DeliveryStatus.未发货;
        /// <summary>
        /// 商品评价
        /// </summary>
        public EvaluateStatus EvaluateStatus { get; set; } = EvaluateStatus.未评价;

        /// <summary>
        /// 供货商结算时间
        /// </summary>
        public DateTime? SettlementTime { get; set; }

        /// <summary>
        /// 结算状态
        /// </summary>
        public SettlementStatus SettlementStatus { get; set; } = SettlementStatus.未结算;

        /// <summary>
        /// 差价
        /// </summary>
        public decimal PriceDifference { get; set; } = 0m;

        /// <summary>
        /// 结算Id
        /// </summary>
        public Guid? SettlementId { get; set; }

        [ForeignKey("SettlementId")]
        public virtual SettlementSupplier Settlement { get; set; }

        /// <summary>
        /// 退货状态
        /// </summary>
        [Display(Name = "退货状态")]
        public Returngoods Returngoods { get; set; } = Returngoods.未退货;
        /// <summary>
        /// 退款金额
        /// </summary>
        [Display(Name = "退货金额")]
        public decimal ReturngoodsPrice { get; set; } = 0m;
        /// <summary>
        /// 退款内容
        /// </summary>
        [Display(Name = "退货内容")]
        public string ReturngoodsContetn { get; set; }
         /// <summary>
        /// 退款内容
        /// </summary>
        [Display(Name = "退货订单号")]
        public string refundNo { get; set; }

    }
    public enum Returngoods : byte
    {
        售后申请,
        未退货,
        退货中,
        平台处理中,
        已退货
    }


    public enum DeliveryStatus : byte
    {
        未发货,
        已发货,
        已确认
    }

    public enum SettlementStatus : byte
    {
        未结算,
        已结算
    }
    public enum EvaluateStatus
    {
        未评价,
        已评价
    }
}
